package com.JingYan.controller;


import com.JingYan.annotation.BaseResponse;
import com.JingYan.service.LogbacksService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author DongJiaQi
 * @create 2022/12/9 10:55
 * @Description: 日志配置
 */

@RestController
@RequestMapping("/Logback")
@Slf4j
@BaseResponse
public class LogbackController {
    @Autowired
    LogbacksService logbacksService;

    /**
     * 启动 debug 日志
     * @return
     */
    @PostMapping("/startDebugLog")
    public boolean startDebugLog(){
        return logbacksService.setFileDebug(2);
    }
    /**
     * 关闭 debug 日志
     * @return
     */
    @PostMapping("/stopDebugLog")
    public boolean stopDebugLog(){
        return logbacksService.setFileDebug(0);
    }
}
